package controllers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/httplib"
)

type TestHttpLibControllers struct {
	beego.Controller
}

func (c *TestHttpLibControllers) Get() {
	req := httplib.Get("https://www.douban.com")
	str, err := req.String()
	if err != nil {
		panic(err)
	}
	c.Ctx.WriteString(str)
}

func (c *TestHttpLibControllers) Post() {
	c.Data["name"] = "beego.me"
	c.Data["age"] = "18"
	c.Data["mysql"] = beego.AppConfig.String("mysqluser")
	c.TplName = "testHttp.html"
}
